package thinking.函数高级

import scala.annotation.tailrec

object 控制抽象 {
  def main(args: Array[String]): Unit = {

    @tailrec
    def until(condition: => Boolean)(block: => Unit): Unit = {
      if (condition) {
        block
        until(condition)(block)
      }
    }

    var x: Int = 10
    until(x > 0) {
      x -= 1
      println(x)
    }
  }

}
